version 14
clear all
pause on
set more off

capture noisily mkdir  "${results}/othergraphs"

************************KID DATA********************************
use ${clean_data}/taxtax_clean if taxyr_cut<=1991 ${rp_ob0_predL12} ${sc_dropany_miss} & inrange(agecyr,23,30), clear
*rename taxyr_out year
rename  tyrc_obstyr i_obstaxyr
rename pob_fips pob

********Figure 5: Effect of Cash Transfer Eligibility on Adult Earnings: By Age*********
regrunner "reghdfe /outcome\ i.belowcut##c.z @{x_/covars\} if  @{tyrcs_/taxyrcuts\} &inrange(z,-/wdays\-/donut\,/wdays\+/donut\-1)& !inrange(z,-/donut\,/donut\-1)  @{r_/sample\} @{r_/restrict\} @{a_/ages\} @{sc_/sch_cuts\} @{rp_/predsamp\}, absorb(@{fe_/covars\}) vce(@{sehdfe_clust_z})", ///
				runs{ outcome[ wagez3 ] ///
				sample[ k1elig ] ///
				predsamp[ predL12 ] ///
				ages[ 23 26 29 32 ] ///
				taxyrcuts[1979_1991 ] ///
				restrict[ all ]  ///
				covars[ tyrc ] ///
				sch_cuts[dropany_miss ] ///
				donut[ 8  ] ///
				wdays[ 20 ] } ///
				coeffs{bcut[1.belowcut]} ///
				stats{ mean0[r(mean), summ /outcome\ if e(sample) & belowcut==0 ] } ///
				dataout{${results}/final_f5} fileout{${results}/final} sheetout{f5} $option


********Figure A10: Effect of Cash Transfer Eligibility on Adult Earnings: By Sex-Age*********
regrunner "reghdfe /outcome\ i.belowcut##c.z @{x_/covars\} if  @{tyrcs_/taxyrcuts\} &inrange(z,-/wdays\-/donut\,/wdays\+/donut\-1)& !inrange(z,-/donut\,/donut\-1)  @{r_/sample\} @{r_/restrict\} @{a_/ages\} @{sc_/sch_cuts\} @{rp_/predsamp\}, absorb(@{fe_/covars\}) vce(@{sehdfe_clust_z})", ///
				runs{ outcome[ wagez3 ] ///
				sample[ k1elig ] ///
				predsamp[ predL12 ] ///
				ages[ 23 26 29 32 ] ///
				taxyrcuts[1979_1991 ] ///
				restrict[ male female ]  ///
				covars[ tyrc ] ///
				sch_cuts[dropany_miss ] ///
				donut[ 8  ] ///
				wdays[ 20 ] } ///
				coeffs{bcut[1.belowcut]} ///
				stats{ mean0[r(mean), summ /outcome\ if e(sample) & belowcut==0 ] } ///
				dataout{${results}/final_fa10} fileout{${results}/final} sheetout{fa10} $option


********Figure A11: Effect of Cash Transfer Eligibility on Adult Earnings: By Cohort-Age*********
regrunner "reghdfe /outcome\ i.belowcut##c.z @{x_/covars\} if  @{tyrcs_/taxyrcuts\} &inrange(z,-/wdays\-/donut\,/wdays\+/donut\-1)& !inrange(z,-/donut\,/donut\-1)  @{r_/sample\} @{r_/restrict\} @{a_/ages\} @{sc_/sch_cuts\} @{rp_/predsamp\}, absorb(@{fe_/covars\}) vce(@{sehdfe_clust_z})", ///
			runs{ outcome[ wagez3 ] ///
			sample[ k1elig ] ///
			predsamp[ predL12 ] ///
			ages[ 23 26 29 32 ] ///
			taxyrcuts[1980_1981 1985_1986 1990_1991 ] ///
			restrict[ all ]  ///
			covars[ tyrc ] ///
			sch_cuts[dropany_miss ] ///
			donut[ 8  ] ///
			wdays[ 20 ] } ///
			coeffs{bcut[1.belowcut]} ///
			stats{ mean0[r(mean), summ /outcome\ if e(sample) & belowcut==0 ] } ///
			dataout{${results}/final_fa11} fileout{${results}/final} sheetout{fa11} $option


********Figure A5: Adult Earnings RD Estimates by Donut Size*********
regrunner "reghdfe /outcome\ i.belowcut##c.z @{x_/covars\} if  @{tyrcs_/taxyrcuts\} &inrange(z,-/wdays\-/donut\,/wdays\+/donut\-1)& !inrange(z,-/donut\,/donut\-1)  @{r_/sample\} @{r_/restrict\} @{a_/ages\} @{sc_/sch_cuts\} @{rp_/predsamp\}, absorb(@{fe_/covars\}) vce(@{sehdfe_clust_z})", ///
				runs{ outcome[ wagez6 wagez3 ] ///
				sample[ k1elig ] ///
				predsamp[ predL12 ] ///
				ages[ 23 26 ] ///
				taxyrcuts[ 1979_1991 ] ///
				restrict[ all  ]  ///
				covars[ tyrc ] ///
				sch_cuts[dropany_miss ] ///
				donut[ 0 1 2 3 4 5 6 7 8  ] ///
				wdays[ 20 ] } ///
				coeffs{bcut[1.belowcut]} ///
				stats{ } ///
				dataout{${results}/final_fa5} fileout{${results}/final} sheetout{fa5} $option

regrunner "reghdfe /outcome\ i.belowcut##c.z @{x_/covars\} if  @{tyrcs_/taxyrcuts\} &inrange(z,-/fullwindow\,/fullwindow\-1)& !inrange(z,-/donut\,/donut\-1)  @{r_/sample\} @{r_/restrict\} @{a_/ages\} @{sc_/sch_cuts\} @{rp_/predsamp\}, absorb(@{fe_/covars\}) vce(@{sehdfe_clust_z})", ///
				runs{ outcome[ wagez3 ] ///
				sample[ k1elig ] ///
				predsamp[ predL12 ] ///
				ages[ 23 26 ] ///
				taxyrcuts[ 1979_1991 ] ///
				restrict[ all ]  ///
				covars[ tyrc ] ///
				sch_cuts[dropany_miss ] ///
				donut[ 9 10 11 12 13 14 15 ] ///
				fullwindow[ 28 ] } ///
				coeffs{bcut[1.belowcut]} ///
				stats{ } ///
				dataout{${results}/final_fa5b} fileout{${results}/final} sheetout{fa5b} $option

********Figure A6: Adult Earnings RD Estimates by Bandwidth*********
regrunner "reghdfe /outcome\ i.belowcut##c.z @{x_/covars\} if  @{tyrcs_/taxyrcuts\} &inrange(z,-/wdays\-/donut\,/wdays\+/donut\-1)& !inrange(z,-/donut\,/donut\-1)  @{r_/sample\} @{r_/restrict\} @{a_/ages\} @{sc_/sch_cuts\} @{rp_/predsamp\}, absorb(@{fe_/covars\}) vce(@{sehdfe_clust_z})", ///
				runs{ outcome[ wagez3 ] ///
				sample[ k1elig ] ///
				predsamp[ predL12 ] ///
				ages[23 26 ] ///
				taxyrcuts[ 1979_1991 ] ///
				restrict[ all  ]  ///
				covars[ tyrc ] ///
				sch_cuts[dropany_miss ] ///
				donut[ 8 ] ///
				wdays[ 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ] } ///
				coeffs{bcut[1.belowcut]} ///
				stats{ } ///
				dataout{${results}/final_fa6} fileout{${results}/final} sheetout{fa6} $option


************************PARENT DATA********************************

use using ${clean_data}/taxtax_parents_mech1_clean, clear
gen parent_maxage = tyrc_maxage
regrunner "reghdfe /outcome\ i.belowcut##c.z @{x_/covars\} if t==/t\ & @{tyrcs_/taxyrcuts\} &inrange(z,-/wdays\-/donut\,/wdays\+/donut\-1)& !inrange(z,-/donut\,/donut\-1)  @{r_/sample\}  @{r_/restrict\} @{sc_/sch_cuts\} @{rp_/predsamp\}, absorb(@{fe_/covars\}) vce(@{sehdfe_clust_z})" , ///
				 runs{ outcome[ parent_wagez i_married0 i_pov0 parent_i_1040 ] ///
				 sample[ k1elig ] ///
				 predsamp[ predL12 ] ///
				 t[ -7 -6 -2 -1 3 4 8 9 10 12 13 14 15 16 17 18 ] ///
				 taxyrcuts[ 1979_1991 ] ///
				 restrict[ all Lfilers]  ///
				 covars[ tyrc ] ///
				 sch_cuts[dropany_miss] ///
				 donut[ 8  ] ///
				 wdays[ 20 ] } ///
				 coeffs{bcut[1.belowcut]} ///
				 stats{	mean0[r(mean), summ /outcome\ if e(sample) & belowcut==0 ]  } ///
				 dataout{${results}/final_tmech} fileout{${results}/final} sheetout{tmech} $option
